package com.yzjs.localhost.controller.dataListByDictionaryId;

import com.yzjs.common.base.entity.PageInfo;
import com.yzjs.common.enumeration.RequestMethod;
import com.yzjs.common.enumeration.ResourceCode;
import com.yzjs.common.util.conversion.JsonUtil;
import com.yzjs.localhost.dto.DataHistoryDTO;
import com.yzjs.localhost.entity.hrmAssessment.HrmAssessmentEntity;
import com.yzjs.localhost.entity.hrmAwardSanction.HrmAwardSanctionEntity;
import com.yzjs.localhost.entity.hrmCertificate.HrmCertificateEntity;
import com.yzjs.localhost.entity.hrmContract.HrmContractEntity;
import com.yzjs.localhost.entity.hrmContractRecord.HrmContractRecordEntity;
import com.yzjs.localhost.entity.hrmEducationInfo.HrmEducationInfoEntity;
import com.yzjs.localhost.entity.hrmFamilyMembers.HrmFamilyMembersEntity;
import com.yzjs.localhost.entity.hrmPositionChange.HrmPositionChangeEntity;
import com.yzjs.localhost.entity.hrmPositionalTitles.HrmPositionalTitlesEntity;
import com.yzjs.localhost.entity.hrmProfessionalQualification.HrmProfessionalQualificationEntity;
import com.yzjs.localhost.entity.hrmRecruitment.HrmRecruitmentEntity;
import com.yzjs.localhost.entity.hrmRsLeave.HrmRsLeaveEntity;
import com.yzjs.localhost.entity.hrmScientific.HrmScientificEntity;
import com.yzjs.localhost.entity.hrmTitleChange.HrmTitleChangeEntity;
import com.yzjs.localhost.entity.hrmUser.HrmUserEntity;
import com.yzjs.localhost.entity.queryParamForDataList.QueryParamForDataListEntity;
import com.yzjs.localhost.entity.sysConfig.SysConfigEntity;
import com.yzjs.localhost.entity.sysDept.SysDeptEntity;
import com.yzjs.localhost.entity.sysDictData.SysDictDataEntity;
import com.yzjs.localhost.entity.sysDictType.SysDictTypeEntity;
import com.yzjs.localhost.entity.sysLogininfor.SysLogininforEntity;
import com.yzjs.localhost.entity.sysMenu.SysMenuEntity;
import com.yzjs.localhost.entity.sysOperLog.SysOperLogEntity;
import com.yzjs.localhost.entity.sysRole.SysRoleEntity;
import com.yzjs.localhost.entity.sysRoleMenu.SysRoleMenuEntity;
import com.yzjs.localhost.entity.sysUser.SysUserEntity;
import com.yzjs.localhost.entity.tDataPersistenceAfter.TDataPersistenceAfterEntity;
import com.yzjs.localhost.entity.tDataPersistenceBeforce.TDataPersistenceBeforceEntity;
import com.yzjs.localhost.entity.tNeusoftSysMenu.TNeusoftSysMenuEntity;
import com.yzjs.localhost.entity.tNeusoftSysUser.TNeusoftSysUserEntity;
import com.yzjs.localhost.service.AnalysisService;
import com.yzjs.localhost.service.hrmAssessment.HrmAssessmentService;
import com.yzjs.localhost.service.hrmAwardSanction.HrmAwardSanctionService;
import com.yzjs.localhost.service.hrmCertificate.HrmCertificateService;
import com.yzjs.localhost.service.hrmContract.HrmContractService;
import com.yzjs.localhost.service.hrmContractRecord.HrmContractRecordService;
import com.yzjs.localhost.service.hrmEducationInfo.HrmEducationInfoService;
import com.yzjs.localhost.service.hrmFamilyMembers.HrmFamilyMembersService;
import com.yzjs.localhost.service.hrmPositionChange.HrmPositionChangeService;
import com.yzjs.localhost.service.hrmPositionalTitles.HrmPositionalTitlesService;
import com.yzjs.localhost.service.hrmProfessionalQualification.HrmProfessionalQualificationService;
import com.yzjs.localhost.service.hrmRecruitment.HrmRecruitmentService;
import com.yzjs.localhost.service.hrmRsLeave.HrmRsLeaveService;
import com.yzjs.localhost.service.hrmScientific.HrmScientificService;
import com.yzjs.localhost.service.hrmTitleChange.HrmTitleChangeService;
import com.yzjs.localhost.service.hrmUser.HrmUserService;
import com.yzjs.localhost.service.sysConfig.SysConfigService;
import com.yzjs.localhost.service.sysDept.SysDeptService;
import com.yzjs.localhost.service.sysDictData.SysDictDataService;
import com.yzjs.localhost.service.sysDictType.SysDictTypeService;
import com.yzjs.localhost.service.sysLogininfor.SysLogininforService;
import com.yzjs.localhost.service.sysMenu.SysMenuService;
import com.yzjs.localhost.service.sysOperLog.SysOperLogService;
import com.yzjs.localhost.service.sysRole.SysRoleService;
import com.yzjs.localhost.service.sysRoleMenu.SysRoleMenuService;
import com.yzjs.localhost.service.sysUser.SysUserService;
import com.yzjs.localhost.service.tDataPersistenceAfter.TDataPersistenceAfterService;
import com.yzjs.localhost.service.tDataPersistenceBeforce.TDataPersistenceBeforceService;
import com.yzjs.localhost.service.tNeusoftSysMenu.TNeusoftSysMenuService;
import com.yzjs.localhost.service.tNeusoftSysUser.TNeusoftSysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Api(tags = "资源列表数据")
@RestController
@RequestMapping("dataListForResourceCode")
public class DataListByDictionaryIdController {
    @Resource
    HrmAssessmentService hrmAssessmentService;
    @Resource
    HrmAwardSanctionService hrmAwardSanctionService;
    @Resource
    HrmCertificateService hrmCertificateService;
    @Resource
    HrmContractService hrmContractService;
    @Resource
    HrmContractRecordService hrmContractRecordService;
    @Resource
    HrmEducationInfoService hrmEducationInfoService;
    @Resource
    HrmFamilyMembersService hrmFamilyMembersService;
    @Resource
    HrmPositionalTitlesService hrmPositionalTitlesService;
    @Resource
    HrmPositionChangeService hrmPositionChangeService;
    @Resource
    HrmProfessionalQualificationService hrmProfessionalQualificationService;
    @Resource
    HrmRecruitmentService hrmRecruitmentService;
    @Resource
    HrmRsLeaveService hrmRsLeaveService;
    @Resource
    HrmScientificService hrmScientificService;
    @Resource
    HrmTitleChangeService hrmTitleChangeService;
    @Resource
    HrmUserService hrmUserService;
    @Resource
    SysConfigService sysConfigService;
    @Resource
    SysDeptService sysDeptService;
    @Resource
    SysDictDataService sysDictDataService;
    @Resource
    SysDictTypeService sysDictTypeService;
    @Resource
    SysLogininforService sysLogininforService;
    @Resource
    SysMenuService sysMenuService;
    @Resource
    SysOperLogService sysOperLogService;
    @Resource
    SysRoleService sysRoleService;
    @Resource
    SysRoleMenuService sysRoleMenuService;
    @Resource
    SysUserService sysUserService;

    @Resource
    TDataPersistenceBeforceService tDataPersistenceBeforceService;
    @Resource
    TDataPersistenceAfterService tDataPersistenceAfterService;
    @Resource
    AnalysisService analysisService;
    @Resource
    TNeusoftSysUserService tNeusoftSysUserService;
    @Resource
    TNeusoftSysMenuService tNeusoftSysMenuService;

    /**
     * 列表查询
     * @return
     */
    @ApiOperation(value="列表查询" ,httpMethod = RequestMethod.POST )
    @RequestMapping("/list")
    public List List(@RequestBody QueryParamForDataListEntity queryParamForDataListEntity) {
        List list =new ArrayList();
        // 获取数据
        String resourceCode = queryParamForDataListEntity.getResourceCode();
        Map<String,Object> paramMap = queryParamForDataListEntity.getParamMap();
        // 数据校验
        if(StringUtils.isEmpty(resourceCode)||paramMap.size()<=0||paramMap.isEmpty()){
            return null;
        }
        // 格式转化(下划线转驼峰)
        Map<String,Object> paramMapNew = new HashMap<>();
        for (String key : paramMap.keySet()) {
            String str = JsonUtil.underline2Camel(key);
            Object value = paramMap.get(key);
            paramMapNew.put(str,value);
        }
        paramMap.clear();

        // 逻辑操作
        switch (resourceCode){
            case ResourceCode.HRM_ASSESSMENT:
                HrmAssessmentEntity hrmAssessmentEntity = JsonUtil.map2pojo(paramMapNew,HrmAssessmentEntity.class);
                list = hrmAssessmentService.findList(hrmAssessmentEntity);
                break;
            case ResourceCode.HRM_AWARD_SANCTION:
                HrmAwardSanctionEntity hrmAwardSanctionEntity = JsonUtil.map2pojo(paramMapNew,HrmAwardSanctionEntity.class);
                list = hrmAwardSanctionService.findList(hrmAwardSanctionEntity);
                break;
            case ResourceCode.HRM_CERTIFICATE:
                HrmCertificateEntity hrmCertificateEntity = JsonUtil.map2pojo(paramMapNew, HrmCertificateEntity.class);
                list = hrmCertificateService.findList(hrmCertificateEntity);
                break;
            case ResourceCode.HRM_CONTRACT:
                HrmContractEntity hrmContractEntity = JsonUtil.map2pojo(paramMapNew, HrmContractEntity.class);
                list = hrmContractService.findList(hrmContractEntity);
                break;
            case ResourceCode.HRM_CONTRACT_RECORD:
                HrmContractRecordEntity hrmContractRecordEntity = JsonUtil.map2pojo(paramMapNew, HrmContractRecordEntity.class);
                list = hrmContractRecordService.findList(hrmContractRecordEntity);
                break;
            case ResourceCode.HRM_EDUCATION_INFO:
                HrmEducationInfoEntity hrmEducationInfoEntity = JsonUtil.map2pojo(paramMapNew, HrmEducationInfoEntity.class);
                list = hrmEducationInfoService.findList(hrmEducationInfoEntity);
                break;
            case ResourceCode.HRM_FAMILY_MEMBERS:
                HrmFamilyMembersEntity hrmFamilyMembersEntity = JsonUtil.map2pojo(paramMapNew, HrmFamilyMembersEntity.class);
                list = hrmFamilyMembersService.findList(hrmFamilyMembersEntity);
                break;
            case ResourceCode.HRM_POSITIONAL_TITLES:
                HrmPositionalTitlesEntity hrmPositionalTitlesEntity = JsonUtil.map2pojo(paramMapNew,HrmPositionalTitlesEntity.class);
                list = hrmPositionalTitlesService.findList(hrmPositionalTitlesEntity);
                break;
            case ResourceCode.HRM_POSITION_CHANGE:
                HrmPositionChangeEntity hrmPositionChangeEntity = JsonUtil.map2pojo(paramMapNew,HrmPositionChangeEntity.class);
                list = hrmPositionChangeService.findList(hrmPositionChangeEntity);
                break;
            case ResourceCode.HRM_PROFESSIONAL_QUALIFICATION:
                HrmProfessionalQualificationEntity hrmProfessionalQualificationEntity = JsonUtil.map2pojo(paramMapNew, HrmProfessionalQualificationEntity.class);
                list = hrmProfessionalQualificationService.findList(hrmProfessionalQualificationEntity);
                break;
            case ResourceCode.HRM_RECRUITMENT:
                HrmRecruitmentEntity hrmRecruitmentEntity = JsonUtil.map2pojo(paramMapNew, HrmRecruitmentEntity.class);
                list = hrmRecruitmentService.findList(hrmRecruitmentEntity);
                break;
            case ResourceCode.HRM_RS_LEAVE:
                HrmRsLeaveEntity hrmRsLeaveEntity = JsonUtil.map2pojo(paramMapNew,HrmRsLeaveEntity.class);
                list = hrmRsLeaveService.findList(hrmRsLeaveEntity);
                break;
            case ResourceCode.HRM_SCIENTIFIC:
                HrmScientificEntity hrmScientificEntity = JsonUtil.map2pojo(paramMapNew, HrmScientificEntity.class);
                list = hrmScientificService.findList(hrmScientificEntity);
                break;
            case ResourceCode.HRM_TITLE_CHANGE:
                HrmTitleChangeEntity hrmTitleChangeEntity = JsonUtil.map2pojo(paramMapNew, HrmTitleChangeEntity.class);
                list = hrmTitleChangeService.findList(hrmTitleChangeEntity);
                break;
            case ResourceCode.HRM_USER:
                HrmUserEntity hrmUserEntity = JsonUtil.map2pojo(paramMapNew,HrmUserEntity.class);
                list = hrmUserService.findList(hrmUserEntity);
                break;
            case ResourceCode.SYS_CONFIG:
                SysConfigEntity sysConfigEntity = JsonUtil.map2pojo(paramMapNew, SysConfigEntity.class);
                list = sysConfigService.findList(sysConfigEntity);
                break;
            case ResourceCode.SYS_DEPT:
                SysDeptEntity sysDeptEntity = JsonUtil.map2pojo(paramMapNew, SysDeptEntity.class);
                list = sysDeptService.findList(sysDeptEntity);
                break;
            case ResourceCode.SYS_DICT_DATA:
                SysDictDataEntity sysDictDataEntity = JsonUtil.map2pojo(paramMapNew, SysDictDataEntity.class);
                list = sysDictDataService.findList(sysDictDataEntity);
                break;
            case ResourceCode.SYS_DICT_TYPE:
                SysDictTypeEntity sysDictTypeEntity = JsonUtil.map2pojo(paramMapNew, SysDictTypeEntity.class);
                list = sysDictTypeService.findList(sysDictTypeEntity);
                break;
            case ResourceCode.SYS_LOGININFOR:
                SysLogininforEntity sysLogininforEntity = JsonUtil.map2pojo(paramMapNew, SysLogininforEntity.class);
                list = sysLogininforService.findList(sysLogininforEntity);
                break;
            case ResourceCode.SYS_MENU:
                SysMenuEntity sysMenuEntity = JsonUtil.map2pojo(paramMapNew, SysMenuEntity.class);
                list = sysMenuService.findList(sysMenuEntity);
                break;
            case ResourceCode.SYS_OPER_LOG:
                SysOperLogEntity sysOperLogEntity = JsonUtil.map2pojo(paramMapNew, SysOperLogEntity.class);
                list = sysOperLogService.findList(sysOperLogEntity);
                break;
            case ResourceCode.SYS_ROLE:
                SysRoleEntity sysRoleEntity = JsonUtil.map2pojo(paramMapNew, SysRoleEntity.class);
                list = sysRoleService.findList(sysRoleEntity);
                break;
            case ResourceCode.SYS_ROLE_MENU:
                SysRoleMenuEntity sysRoleMenuEntity = JsonUtil.map2pojo(paramMapNew, SysRoleMenuEntity.class);
                list = sysRoleMenuService.findList(sysRoleMenuEntity);
                break;
            case ResourceCode.SYS_USER:
                SysUserEntity sysUserEntity = JsonUtil.map2pojo(paramMapNew, SysUserEntity.class);
                list = sysUserService.findList(sysUserEntity);
                break;
            default:
                break;
        }

        return list;
    }

    /**
     * 列表查询
     * @return
     */
    @ApiOperation(value="列表分页查询" ,httpMethod = RequestMethod.POST )
    @RequestMapping("/listPage")
    public PageInfo ListPage(@RequestBody QueryParamForDataListEntity queryParamForDataListEntity) {
        List list =new ArrayList();
        PageInfo pageInfo = null;
        // 获取数据
        String resourceCode = queryParamForDataListEntity.getResourceCode();
        Map<String,Object> paramMap = queryParamForDataListEntity.getParamMap();
        // 数据校验
        if(StringUtils.isEmpty(resourceCode) || paramMap.size() <= 0){
            return null;
        }
        // 格式转化(下划线转驼峰)
        Map<String,Object> paramMapNew = new HashMap<>();
        for (String key : paramMap.keySet()) {
            String str = JsonUtil.underline2Camel(key);
            Object value = paramMap.get(key);
            paramMapNew.put(str,value);
        }
        paramMap.clear();

        // 逻辑操作
        switch (resourceCode){
            case ResourceCode.HRM_ASSESSMENT:
                HrmAssessmentEntity hrmAssessmentEntity = JsonUtil.map2pojo(paramMapNew,HrmAssessmentEntity.class);
                list = hrmAssessmentService.findList(hrmAssessmentEntity);
                pageInfo = new PageInfo<>(list ,hrmAssessmentEntity);
                break;
            case ResourceCode.HRM_AWARD_SANCTION:
                HrmAwardSanctionEntity hrmAwardSanctionEntity = JsonUtil.map2pojo(paramMapNew,HrmAwardSanctionEntity.class);
                list = hrmAwardSanctionService.findList(hrmAwardSanctionEntity);
                pageInfo = new PageInfo<>(list ,hrmAwardSanctionEntity);
                break;
            case ResourceCode.HRM_CERTIFICATE:
                HrmCertificateEntity hrmCertificateEntity = JsonUtil.map2pojo(paramMapNew, HrmCertificateEntity.class);
                list = hrmCertificateService.findList(hrmCertificateEntity);
                pageInfo = new PageInfo<>(list ,hrmCertificateEntity);
                break;
            case ResourceCode.HRM_CONTRACT:
                HrmContractEntity hrmContractEntity = JsonUtil.map2pojo(paramMapNew, HrmContractEntity.class);
                list = hrmContractService.findList(hrmContractEntity);
                pageInfo = new PageInfo<>(list ,hrmContractEntity);
                break;
            case ResourceCode.HRM_CONTRACT_RECORD:
                HrmContractRecordEntity hrmContractRecordEntity = JsonUtil.map2pojo(paramMapNew, HrmContractRecordEntity.class);
                list = hrmContractRecordService.findList(hrmContractRecordEntity);
                pageInfo = new PageInfo<>(list ,hrmContractRecordEntity);
                break;
            case ResourceCode.HRM_EDUCATION_INFO:
                HrmEducationInfoEntity hrmEducationInfoEntity = JsonUtil.map2pojo(paramMapNew, HrmEducationInfoEntity.class);
                list = hrmEducationInfoService.findList(hrmEducationInfoEntity);
                pageInfo = new PageInfo<>(list ,hrmEducationInfoEntity);
                break;
            case ResourceCode.HRM_FAMILY_MEMBERS:
                HrmFamilyMembersEntity hrmFamilyMembersEntity = JsonUtil.map2pojo(paramMapNew, HrmFamilyMembersEntity.class);
                list = hrmFamilyMembersService.findList(hrmFamilyMembersEntity);
                pageInfo = new PageInfo<>(list ,hrmFamilyMembersEntity);
                break;
            case ResourceCode.HRM_POSITIONAL_TITLES:
                HrmPositionalTitlesEntity hrmPositionalTitlesEntity = JsonUtil.map2pojo(paramMapNew,HrmPositionalTitlesEntity.class);
                list = hrmPositionalTitlesService.findList(hrmPositionalTitlesEntity);
                pageInfo = new PageInfo<>(list ,hrmPositionalTitlesEntity);
                break;
            case ResourceCode.HRM_POSITION_CHANGE:
                HrmPositionChangeEntity hrmPositionChangeEntity = JsonUtil.map2pojo(paramMapNew,HrmPositionChangeEntity.class);
                list = hrmPositionChangeService.findList(hrmPositionChangeEntity);
                pageInfo = new PageInfo<>(list ,hrmPositionChangeEntity);
                break;
            case ResourceCode.HRM_PROFESSIONAL_QUALIFICATION:
                HrmProfessionalQualificationEntity hrmProfessionalQualificationEntity = JsonUtil.map2pojo(paramMapNew, HrmProfessionalQualificationEntity.class);
                list = hrmProfessionalQualificationService.findList(hrmProfessionalQualificationEntity);
                pageInfo = new PageInfo<>(list ,hrmProfessionalQualificationEntity);
                break;
            case ResourceCode.HRM_RECRUITMENT:
                HrmRecruitmentEntity hrmRecruitmentEntity = JsonUtil.map2pojo(paramMapNew, HrmRecruitmentEntity.class);
                list = hrmRecruitmentService.findList(hrmRecruitmentEntity);
                pageInfo = new PageInfo<>(list ,hrmRecruitmentEntity);
                break;
            case ResourceCode.HRM_RS_LEAVE:
                HrmRsLeaveEntity hrmRsLeaveEntity = JsonUtil.map2pojo(paramMapNew,HrmRsLeaveEntity.class);
                list = hrmRsLeaveService.findList(hrmRsLeaveEntity);
                pageInfo = new PageInfo<>(list ,hrmRsLeaveEntity);
                break;
            case ResourceCode.HRM_SCIENTIFIC:
                HrmScientificEntity hrmScientificEntity = JsonUtil.map2pojo(paramMapNew, HrmScientificEntity.class);
                list = hrmScientificService.findList(hrmScientificEntity);
                pageInfo = new PageInfo<>(list ,hrmScientificEntity);
                break;
            case ResourceCode.HRM_TITLE_CHANGE:
                HrmTitleChangeEntity hrmTitleChangeEntity = JsonUtil.map2pojo(paramMapNew, HrmTitleChangeEntity.class);
                list = hrmTitleChangeService.findList(hrmTitleChangeEntity);
                pageInfo = new PageInfo<>(list ,hrmTitleChangeEntity);
                break;
            case ResourceCode.HRM_USER:
                HrmUserEntity hrmUserEntity = JsonUtil.map2pojo(paramMapNew,HrmUserEntity.class);
                list = hrmUserService.findList(hrmUserEntity);
                pageInfo = new PageInfo<>(list ,hrmUserEntity);
                break;
            case ResourceCode.SYS_CONFIG:
                SysConfigEntity sysConfigEntity = JsonUtil.map2pojo(paramMapNew, SysConfigEntity.class);
                list = sysConfigService.findList(sysConfigEntity);
                pageInfo = new PageInfo<>(list ,sysConfigEntity);
                break;
            case ResourceCode.SYS_DEPT:
                SysDeptEntity sysDeptEntity = JsonUtil.map2pojo(paramMapNew, SysDeptEntity.class);
                list = sysDeptService.findList(sysDeptEntity);
                pageInfo = new PageInfo<>(list ,sysDeptEntity);
                break;
            case ResourceCode.SYS_DICT_DATA:
                SysDictDataEntity sysDictDataEntity = JsonUtil.map2pojo(paramMapNew, SysDictDataEntity.class);
                list = sysDictDataService.findList(sysDictDataEntity);
                pageInfo = new PageInfo<>(list ,sysDictDataEntity);
                break;
            case ResourceCode.SYS_DICT_TYPE:
                SysDictTypeEntity sysDictTypeEntity = JsonUtil.map2pojo(paramMapNew, SysDictTypeEntity.class);
                list = sysDictTypeService.findList(sysDictTypeEntity);
                pageInfo = new PageInfo<>(list ,sysDictTypeEntity);
                break;
            case ResourceCode.SYS_LOGININFOR:
                SysLogininforEntity sysLogininforEntity = JsonUtil.map2pojo(paramMapNew, SysLogininforEntity.class);
                list = sysLogininforService.findList(sysLogininforEntity);
                pageInfo = new PageInfo<>(list ,sysLogininforEntity);
                break;
            case ResourceCode.SYS_MENU:
                SysMenuEntity sysMenuEntity = JsonUtil.map2pojo(paramMapNew, SysMenuEntity.class);
                list = sysMenuService.findList(sysMenuEntity);
                pageInfo = new PageInfo<>(list ,sysMenuEntity);
                break;
            case ResourceCode.SYS_OPER_LOG:
                SysOperLogEntity sysOperLogEntity = JsonUtil.map2pojo(paramMapNew, SysOperLogEntity.class);
                list = sysOperLogService.findList(sysOperLogEntity);
                pageInfo = new PageInfo<>(list ,sysOperLogEntity);
                break;
            case ResourceCode.SYS_ROLE:
                SysRoleEntity sysRoleEntity = JsonUtil.map2pojo(paramMapNew, SysRoleEntity.class);
                list = sysRoleService.findList(sysRoleEntity);
                pageInfo = new PageInfo<>(list ,sysRoleEntity);
                break;
            case ResourceCode.SYS_ROLE_MENU:
                SysRoleMenuEntity sysRoleMenuEntity = JsonUtil.map2pojo(paramMapNew, SysRoleMenuEntity.class);
                list = sysRoleMenuService.findList(sysRoleMenuEntity);
                pageInfo = new PageInfo<>(list ,sysRoleMenuEntity);
                break;
            case ResourceCode.SYS_USER:
                SysUserEntity sysUserEntity = JsonUtil.map2pojo(paramMapNew, SysUserEntity.class);
                list = sysUserService.findList(sysUserEntity);
                pageInfo = new PageInfo<>(list ,sysUserEntity);
                break;
            default:
                break;
        }

        return pageInfo;
    }

    /**
     * 资源溯源列表查询
     * @return
     */
    @ApiOperation(value="资源溯源列表查询" ,httpMethod = RequestMethod.GET )
    @RequestMapping("/listForHistory")
    public List ListForResourceCodeAndParam(String resourceCode,String dataIdentification) {
        List list =new ArrayList();
        // 初始化缓存数据
        analysisService.InitRoles();
        // 数据校验
        if(StringUtils.isEmpty(resourceCode)||StringUtils.isEmpty(dataIdentification)){
            return null;
        }

        // 逻辑操作
        switch (resourceCode){
            case ResourceCode.HRM_ASSESSMENT:
                // 根据唯一标识查询对应id
                HrmAssessmentEntity hrmAssessment = new HrmAssessmentEntity();
                hrmAssessment.setDataIdentification(dataIdentification);
                HrmAssessmentEntity assessment = hrmAssessmentService.findList(hrmAssessment).get(0);

                HrmAssessmentEntity hrmAssessmentEntity = new HrmAssessmentEntity();
                hrmAssessmentEntity.setAmtId(assessment.getAmtId());
                List<HrmAssessmentEntity> hrmAssessmentEntityList = hrmAssessmentService.findList(hrmAssessmentEntity);
                for (HrmAssessmentEntity hrmAssessmentEntity1 : hrmAssessmentEntityList) {
                    DataHistoryDTO dataHistoryDTO = new DataHistoryDTO();
                    dataHistoryDTO.setObject(hrmAssessmentEntity1);
                    dataHistoryDTO = setDataHistoryDTO(dataHistoryDTO,hrmAssessmentEntity1.getDataIdentification());
                    list.add(dataHistoryDTO);
                }
                break;
            case ResourceCode.HRM_AWARD_SANCTION:
                // 根据唯一标识查询对应id
                HrmAwardSanctionEntity hrmAwardSanction = new HrmAwardSanctionEntity();
                hrmAwardSanction.setDataIdentification(dataIdentification);
                HrmAwardSanctionEntity awardSanction = hrmAwardSanctionService.findList(hrmAwardSanction).get(0);

                HrmAwardSanctionEntity hrmAwardSanctionEntity = new HrmAwardSanctionEntity();
                hrmAwardSanctionEntity.setHasId(awardSanction.getHasId());
                List<HrmAwardSanctionEntity> hrmAwardSanctionEntityList = hrmAwardSanctionService.findList(hrmAwardSanctionEntity);
                for (HrmAwardSanctionEntity hrmAwardSanctionEntity1 : hrmAwardSanctionEntityList) {
                    DataHistoryDTO dataHistoryDTO = new DataHistoryDTO();
                    dataHistoryDTO.setObject(hrmAwardSanctionEntity1);
                    dataHistoryDTO = setDataHistoryDTO(dataHistoryDTO,hrmAwardSanctionEntity1.getDataIdentification());
                    list.add(dataHistoryDTO);
                }
                break;
            case ResourceCode.HRM_CERTIFICATE:
                // 根据唯一标识查询对应id
                HrmCertificateEntity hrmCertificate = new HrmCertificateEntity();
                hrmCertificate.setDataIdentification(dataIdentification);
                HrmCertificateEntity certificate = hrmCertificateService.findList(hrmCertificate).get(0);

                HrmCertificateEntity hrmCertificateEntity = new HrmCertificateEntity();
                hrmCertificateEntity.setCertId(certificate.getCertId());
                List<HrmCertificateEntity> hrmCertificateEntityList = hrmCertificateService.findList(hrmCertificateEntity);
                for (HrmCertificateEntity hrmCertificateEntity1 : hrmCertificateEntityList) {
                    DataHistoryDTO dataHistoryDTO = new DataHistoryDTO();
                    dataHistoryDTO.setObject(hrmCertificateEntity1);
                    dataHistoryDTO = setDataHistoryDTO(dataHistoryDTO,hrmCertificateEntity1.getDataIdentification());
                    list.add(dataHistoryDTO);
                }
                break;
            case ResourceCode.HRM_CONTRACT:
                // 根据唯一标识查询对应id
                HrmContractEntity hrmContract = new HrmContractEntity();
                hrmContract.setDataIdentification(dataIdentification);
                HrmContractEntity contract = hrmContractService.findList(hrmContract).get(0);

                HrmContractEntity hrmContractEntity = new HrmContractEntity();
                hrmContractEntity.setContractId(contract.getContractId());
                List<HrmContractEntity> hrmContractEntityList = hrmContractService.findList(hrmContractEntity);
                for (HrmContractEntity hrmContractEntity1 : hrmContractEntityList) {
                    DataHistoryDTO dataHistoryDTO = new DataHistoryDTO();
                    dataHistoryDTO.setObject(hrmContractEntity1);
                    dataHistoryDTO = setDataHistoryDTO(dataHistoryDTO,hrmContractEntity1.getDataIdentification());
                    list.add(dataHistoryDTO);
                }
                break;
            case ResourceCode.HRM_CONTRACT_RECORD:
                // 根据唯一标识查询对应id
                HrmContractRecordEntity hrmContractRecord = new HrmContractRecordEntity();
                hrmContractRecord.setDataIdentification(dataIdentification);
                HrmContractRecordEntity contractRecord = hrmContractRecordService.findList(hrmContractRecord).get(0);

                HrmContractRecordEntity hrmContractRecordEntity = new HrmContractRecordEntity();
                hrmContractRecordEntity.setContractId(contractRecord.getContractId());
                List<HrmContractRecordEntity> hrmContractRecordEntityList = hrmContractRecordService.findList(hrmContractRecordEntity);
                for (HrmContractRecordEntity hrmContractRecordEntity1 : hrmContractRecordEntityList) {
                    DataHistoryDTO dataHistoryDTO = new DataHistoryDTO();
                    dataHistoryDTO.setObject(hrmContractRecordEntity1);
                    dataHistoryDTO = setDataHistoryDTO(dataHistoryDTO,hrmContractRecordEntity1.getDataIdentification());
                    list.add(dataHistoryDTO);
                }
                break;
            case ResourceCode.HRM_EDUCATION_INFO:
                // 根据唯一标识查询对应id
                HrmEducationInfoEntity hrmEducationInfo = new HrmEducationInfoEntity();
                hrmEducationInfo.setDataIdentification(dataIdentification);
                HrmEducationInfoEntity educationInfo = hrmEducationInfoService.findList(hrmEducationInfo).get(0);

                HrmEducationInfoEntity hrmEducationInfoEntity = new HrmEducationInfoEntity();
                hrmEducationInfoEntity.setEduId(educationInfo.getEduId());
                List<HrmEducationInfoEntity> hrmEducationInfoEntityList = hrmEducationInfoService.findList(hrmEducationInfoEntity);
                for (HrmEducationInfoEntity hrmEducationInfoEntity1 : hrmEducationInfoEntityList) {
                    DataHistoryDTO dataHistoryDTO = new DataHistoryDTO();
                    dataHistoryDTO.setObject(hrmEducationInfoEntity1);
                    dataHistoryDTO = setDataHistoryDTO(dataHistoryDTO,hrmEducationInfoEntity1.getDataIdentification());
                    list.add(dataHistoryDTO);
                }
                break;
            case ResourceCode.HRM_FAMILY_MEMBERS:
                // 根据唯一标识查询对应id
                HrmFamilyMembersEntity hrmFamilyMembers = new HrmFamilyMembersEntity();
                hrmFamilyMembers.setDataIdentification(dataIdentification);
                HrmFamilyMembersEntity familyMembers = hrmFamilyMembersService.findList(hrmFamilyMembers).get(0);

                HrmFamilyMembersEntity hrmFamilyMembersEntity = new HrmFamilyMembersEntity();
                hrmFamilyMembersEntity.setFamId(familyMembers.getFamId());
                List<HrmFamilyMembersEntity> hrmFamilyMembersEntityList = hrmFamilyMembersService.findList(hrmFamilyMembersEntity);
                for (HrmFamilyMembersEntity hrmFamilyMembersEntity1 : hrmFamilyMembersEntityList) {
                    DataHistoryDTO dataHistoryDTO = new DataHistoryDTO();
                    dataHistoryDTO.setObject(hrmFamilyMembersEntity1);
                    dataHistoryDTO = setDataHistoryDTO(dataHistoryDTO,hrmFamilyMembersEntity1.getDataIdentification());
                    list.add(dataHistoryDTO);
                }
                break;
            case ResourceCode.HRM_POSITIONAL_TITLES:
                // 根据唯一标识查询对应id
                HrmPositionalTitlesEntity hrmPositionalTitles = new HrmPositionalTitlesEntity();
                hrmPositionalTitles.setDataIdentification(dataIdentification);
                HrmPositionalTitlesEntity positionalTitles = hrmPositionalTitlesService.findList(hrmPositionalTitles).get(0);

                HrmPositionalTitlesEntity hrmPositionalTitlesEntity = new HrmPositionalTitlesEntity();
                hrmPositionalTitlesEntity.setPostIds(positionalTitles.getPostIds());
                List<HrmPositionalTitlesEntity> hrmPositionalTitlesEntityList = hrmPositionalTitlesService.findList(hrmPositionalTitlesEntity);
                for (HrmPositionalTitlesEntity hrmPositionalTitlesEntity1 : hrmPositionalTitlesEntityList) {
                    DataHistoryDTO dataHistoryDTO = new DataHistoryDTO();
                    dataHistoryDTO.setObject(hrmPositionalTitlesEntity1);
                    dataHistoryDTO = setDataHistoryDTO(dataHistoryDTO,hrmPositionalTitlesEntity1.getDataIdentification());
                    list.add(dataHistoryDTO);
                }
                break;
            case ResourceCode.HRM_POSITION_CHANGE:
                // 根据唯一标识查询对应id
                HrmPositionChangeEntity hrmPositionChange = new HrmPositionChangeEntity();
                hrmPositionChange.setDataIdentification(dataIdentification);
                HrmPositionChangeEntity positionChange = hrmPositionChangeService.findList(hrmPositionChange).get(0);

                HrmPositionChangeEntity hrmPositionChangeEntity = new HrmPositionChangeEntity();
                hrmPositionChangeEntity.setPpId(positionChange.getPpId());
                List<HrmPositionChangeEntity> hrmPositionChangeEntityList = hrmPositionChangeService.findList(hrmPositionChangeEntity);
                for (HrmPositionChangeEntity hrmPositionChangeEntity1 : hrmPositionChangeEntityList) {
                    DataHistoryDTO dataHistoryDTO = new DataHistoryDTO();
                    dataHistoryDTO.setObject(hrmPositionChangeEntity1);
                    dataHistoryDTO = setDataHistoryDTO(dataHistoryDTO,hrmPositionChangeEntity1.getDataIdentification());
                    list.add(dataHistoryDTO);
                }
                break;
            case ResourceCode.HRM_PROFESSIONAL_QUALIFICATION:
                // 根据唯一标识查询对应id
                HrmProfessionalQualificationEntity hrmProfessionalQualification = new HrmProfessionalQualificationEntity();
                hrmProfessionalQualification.setDataIdentification(dataIdentification);
                HrmProfessionalQualificationEntity professionalQualification = hrmProfessionalQualificationService.findList(hrmProfessionalQualification).get(0);

                HrmProfessionalQualificationEntity hrmProfessionalQualificationEntity = new HrmProfessionalQualificationEntity();
                hrmProfessionalQualificationEntity.setQuaId(professionalQualification.getQuaId());
                List<HrmProfessionalQualificationEntity> hrmProfessionalQualificationEntityList = hrmProfessionalQualificationService.findList(hrmProfessionalQualificationEntity);
                for (HrmProfessionalQualificationEntity hrmProfessionalQualificationEntity1 : hrmProfessionalQualificationEntityList) {
                    DataHistoryDTO dataHistoryDTO = new DataHistoryDTO();
                    dataHistoryDTO.setObject(hrmProfessionalQualificationEntity1);
                    dataHistoryDTO = setDataHistoryDTO(dataHistoryDTO,hrmProfessionalQualificationEntity1.getDataIdentification());
                    list.add(dataHistoryDTO);
                }
                break;
            case ResourceCode.HRM_RECRUITMENT:
                // 根据唯一标识查询对应id
                HrmRecruitmentEntity hrmRecruitment = new HrmRecruitmentEntity();
                hrmRecruitment.setDataIdentification(dataIdentification);
                HrmRecruitmentEntity recruitment = hrmRecruitmentService.findList(hrmRecruitment).get(0);

                HrmRecruitmentEntity hrmRecruitmentEntity = new HrmRecruitmentEntity();
                hrmRecruitmentEntity.setStaffUserId(recruitment.getStaffUserId());
                List<HrmRecruitmentEntity> hrmRecruitmentEntityList = hrmRecruitmentService.findList(hrmRecruitmentEntity);
                for (HrmRecruitmentEntity hrmRecruitmentEntity1 : hrmRecruitmentEntityList) {
                    DataHistoryDTO dataHistoryDTO = new DataHistoryDTO();
                    dataHistoryDTO.setObject(hrmRecruitmentEntity1);
                    dataHistoryDTO = setDataHistoryDTO(dataHistoryDTO,hrmRecruitmentEntity1.getDataIdentification());
                    list.add(dataHistoryDTO);
                }
                break;
            case ResourceCode.HRM_RS_LEAVE:
                // 根据唯一标识查询对应id
                HrmRsLeaveEntity hrmRsLeave = new HrmRsLeaveEntity();
                hrmRsLeave.setDataIdentification(dataIdentification);
                HrmRsLeaveEntity rsLeave = hrmRsLeaveService.findList(hrmRsLeave).get(0);

                HrmRsLeaveEntity hrmRsLeaveEntity = new HrmRsLeaveEntity();
                hrmRsLeaveEntity.setLeaveId(rsLeave.getLeaveId());
                List<HrmRsLeaveEntity> hrmRsLeaveEntityList = hrmRsLeaveService.findList(hrmRsLeaveEntity);
                for (HrmRsLeaveEntity hrmRsLeaveEntity1 : hrmRsLeaveEntityList) {
                    DataHistoryDTO dataHistoryDTO = new DataHistoryDTO();
                    dataHistoryDTO.setObject(hrmRsLeaveEntity1);
                    dataHistoryDTO = setDataHistoryDTO(dataHistoryDTO,hrmRsLeaveEntity1.getDataIdentification());
                    list.add(dataHistoryDTO);
                }
                break;
            case ResourceCode.HRM_SCIENTIFIC:
                // 根据唯一标识查询对应id
                HrmScientificEntity hrmScientific = new HrmScientificEntity();
                hrmScientific.setDataIdentification(dataIdentification);
                HrmScientificEntity scientific = hrmScientificService.findList(hrmScientific).get(0);

                HrmScientificEntity hrmScientificEntity = new HrmScientificEntity();
                hrmScientificEntity.setKycgId(scientific.getKycgId());
                List<HrmScientificEntity> hrmScientificEntityList = hrmScientificService.findList(hrmScientificEntity);
                for (HrmScientificEntity hrmScientificEntity1 : hrmScientificEntityList) {
                    DataHistoryDTO dataHistoryDTO = new DataHistoryDTO();
                    dataHistoryDTO.setObject(hrmScientificEntity1);
                    dataHistoryDTO = setDataHistoryDTO(dataHistoryDTO,hrmScientificEntity1.getDataIdentification());
                    list.add(dataHistoryDTO);
                }
                break;
            case ResourceCode.HRM_TITLE_CHANGE:
                // 根据唯一标识查询对应id
                HrmTitleChangeEntity hrmTitleChange = new HrmTitleChangeEntity();
                hrmTitleChange.setDataIdentification(dataIdentification);
                HrmTitleChangeEntity titleChange = hrmTitleChangeService.findList(hrmTitleChange).get(0);

                HrmTitleChangeEntity hrmTitleChangeEntity = new HrmTitleChangeEntity();
                hrmTitleChangeEntity.setTcId(titleChange.getTcId());
                List<HrmTitleChangeEntity> hrmTitleChangeEntityList = hrmTitleChangeService.findList(hrmTitleChangeEntity);
                for (HrmTitleChangeEntity hrmTitleChangeEntity1 : hrmTitleChangeEntityList) {
                    DataHistoryDTO dataHistoryDTO = new DataHistoryDTO();
                    dataHistoryDTO.setObject(hrmTitleChangeEntity1);
                    dataHistoryDTO = setDataHistoryDTO(dataHistoryDTO,hrmTitleChangeEntity1.getDataIdentification());
                    list.add(dataHistoryDTO);
                }
                break;
            case ResourceCode.HRM_USER:
                // 根据唯一标识查询对应id
                HrmUserEntity hrmUser = new HrmUserEntity();
                hrmUser.setDataIdentification(dataIdentification);
                HrmUserEntity user = hrmUserService.findList(hrmUser).get(0);

                HrmUserEntity hrmUserEntity = new HrmUserEntity();
                hrmUserEntity.setStaffUserId(user.getStaffUserId());
                List<HrmUserEntity> hrmUserEntityList = hrmUserService.findList(hrmUserEntity);
                for (HrmUserEntity hrmUserEntity1 : hrmUserEntityList) {
                    DataHistoryDTO dataHistoryDTO = new DataHistoryDTO();
                    dataHistoryDTO.setObject(hrmUserEntity1);
                    dataHistoryDTO = setDataHistoryDTO(dataHistoryDTO,hrmUserEntity1.getDataIdentification());
                    list.add(dataHistoryDTO);
                }
                break;
            case ResourceCode.SYS_CONFIG:
                // 根据唯一标识查询对应id
                SysConfigEntity sysConfig = new SysConfigEntity();
                sysConfig.setDataIdentification(dataIdentification);
                SysConfigEntity config = sysConfigService.findList(sysConfig).get(0);

                SysConfigEntity sysConfigEntity = new SysConfigEntity();
                sysConfigEntity.setConfigId(config.getConfigId());
                List<SysConfigEntity> sysConfigEntityList = sysConfigService.findList(sysConfigEntity);
                for (SysConfigEntity sysConfigEntity1 : sysConfigEntityList) {
                    DataHistoryDTO dataHistoryDTO = new DataHistoryDTO();
                    dataHistoryDTO.setObject(sysConfigEntity1);
                    dataHistoryDTO = setDataHistoryDTO(dataHistoryDTO,sysConfigEntity1.getDataIdentification());
                    list.add(dataHistoryDTO);
                }
                break;
            case ResourceCode.SYS_DEPT:
                // 根据唯一标识查询对应id
                SysDeptEntity sysDept = new SysDeptEntity();
                sysDept.setDataIdentification(dataIdentification);
                SysDeptEntity dept = sysDeptService.findList(sysDept).get(0);

                SysDeptEntity sysDeptEntity = new SysDeptEntity();
                sysDeptEntity.setDeptId(dept.getDeptId());
                List<SysDeptEntity> sysDeptEntityList = sysDeptService.findList(sysDeptEntity);
                for (SysDeptEntity sysDeptEntity1 : sysDeptEntityList) {
                    DataHistoryDTO dataHistoryDTO = new DataHistoryDTO();
                    dataHistoryDTO.setObject(sysDeptEntity1);
                    dataHistoryDTO = setDataHistoryDTO(dataHistoryDTO,sysDeptEntity1.getDataIdentification());
                    list.add(dataHistoryDTO);
                }
                break;
            case ResourceCode.SYS_DICT_DATA:
                // 根据唯一标识查询对应id
                SysDictDataEntity sysDictData = new SysDictDataEntity();
                sysDictData.setDataIdentification(dataIdentification);
                SysDictDataEntity dictData = sysDictDataService.findList(sysDictData).get(0);

                SysDictDataEntity sysDictDataEntity = new SysDictDataEntity();
                sysDictDataEntity.setDictCode(dictData.getDictCode());
                List<SysDictDataEntity> sysDictDataEntityList = sysDictDataService.findList(sysDictDataEntity);
                for (SysDictDataEntity sysDictDataEntity1 : sysDictDataEntityList) {
                    DataHistoryDTO dataHistoryDTO = new DataHistoryDTO();
                    dataHistoryDTO.setObject(sysDictDataEntity1);
                    dataHistoryDTO = setDataHistoryDTO(dataHistoryDTO,sysDictDataEntity1.getDataIdentification());
                    list.add(dataHistoryDTO);
                }
                break;
            case ResourceCode.SYS_DICT_TYPE:
                // 根据唯一标识查询对应id
                SysDictTypeEntity sysDictType = new SysDictTypeEntity();
                sysDictType.setDataIdentification(dataIdentification);
                SysDictTypeEntity dictType = sysDictTypeService.findList(sysDictType).get(0);

                SysDictTypeEntity sysDictTypeEntity = new SysDictTypeEntity();
                sysDictTypeEntity.setDictId(dictType.getDictId());
                List<SysDictTypeEntity> sysDictTypeEntityList = sysDictTypeService.findList(sysDictTypeEntity);
                for (SysDictTypeEntity sysDictTypeEntity1 : sysDictTypeEntityList) {
                    DataHistoryDTO dataHistoryDTO = new DataHistoryDTO();
                    dataHistoryDTO.setObject(sysDictTypeEntity1);
                    dataHistoryDTO = setDataHistoryDTO(dataHistoryDTO,sysDictTypeEntity1.getDataIdentification());
                    list.add(dataHistoryDTO);
                }
                break;
            case ResourceCode.SYS_LOGININFOR:
                // 根据唯一标识查询对应id
                SysLogininforEntity sysLogininfor = new SysLogininforEntity();
                sysLogininfor.setDataIdentification(dataIdentification);
                SysLogininforEntity logininfor = sysLogininforService.findList(sysLogininfor).get(0);

                SysLogininforEntity sysLogininforEntity = new SysLogininforEntity();
                sysLogininforEntity.setInfoId(logininfor.getInfoId());
                List<SysLogininforEntity> sysLogininforEntityList = sysLogininforService.findList(sysLogininforEntity);
                for (SysLogininforEntity sysLogininforEntity1 : sysLogininforEntityList) {
                    DataHistoryDTO dataHistoryDTO = new DataHistoryDTO();
                    dataHistoryDTO.setObject(sysLogininforEntity1);
                    dataHistoryDTO = setDataHistoryDTO(dataHistoryDTO,sysLogininforEntity1.getDataIdentification());
                    list.add(dataHistoryDTO);
                }
                break;
            case ResourceCode.SYS_MENU:
                // 根据唯一标识查询对应id
                SysMenuEntity sysMenu = new SysMenuEntity();
                sysMenu.setDataIdentification(dataIdentification);
                SysMenuEntity menu = sysMenuService.findList(sysMenu).get(0);

                SysMenuEntity sysMenuEntity = new SysMenuEntity();
                sysMenuEntity.setMenuId(menu.getMenuId());
                List<SysMenuEntity> sysMenuEntityList = sysMenuService.findList(sysMenuEntity);
                for (SysMenuEntity sysMenuEntity1 : sysMenuEntityList) {
                    DataHistoryDTO dataHistoryDTO = new DataHistoryDTO();
                    dataHistoryDTO.setObject(sysMenuEntity1);
                    dataHistoryDTO = setDataHistoryDTO(dataHistoryDTO,sysMenuEntity1.getDataIdentification());
                    list.add(dataHistoryDTO);
                }
                break;
            case ResourceCode.SYS_OPER_LOG:
                // 根据唯一标识查询对应id
                SysOperLogEntity sysOperLog = new SysOperLogEntity();
                sysOperLog.setDataIdentification(dataIdentification);
                SysOperLogEntity operLog = sysOperLogService.findList(sysOperLog).get(0);

                SysOperLogEntity sysOperLogEntity = new SysOperLogEntity();
                sysOperLogEntity.setOperId(operLog.getOperId());
                List<SysOperLogEntity> sysOperLogEntityList = sysOperLogService.findList(sysOperLogEntity);
                for (SysOperLogEntity sysOperLogEntity1 : sysOperLogEntityList) {
                    DataHistoryDTO dataHistoryDTO = new DataHistoryDTO();
                    dataHistoryDTO.setObject(sysOperLogEntity1);
                    dataHistoryDTO = setDataHistoryDTO(dataHistoryDTO,sysOperLogEntity1.getDataIdentification());
                    list.add(dataHistoryDTO);
                }
                break;
            case ResourceCode.SYS_ROLE:
                // 根据唯一标识查询对应id
                SysRoleEntity sysRole = new SysRoleEntity();
                sysRole.setDataIdentification(dataIdentification);
                SysRoleEntity role = sysRoleService.findList(sysRole).get(0);

                SysRoleEntity sysRoleEntity = new SysRoleEntity();
                sysRoleEntity.setRoleId(role.getRoleId());
                List<SysRoleEntity> sysRoleEntityList = sysRoleService.findList(sysRoleEntity);
                for (SysRoleEntity sysRoleEntity1 : sysRoleEntityList) {
                    DataHistoryDTO dataHistoryDTO = new DataHistoryDTO();
                    dataHistoryDTO.setObject(sysRoleEntity1);
                    dataHistoryDTO = setDataHistoryDTO(dataHistoryDTO,sysRoleEntity1.getDataIdentification());
                    list.add(dataHistoryDTO);
                }
                break;
            case ResourceCode.SYS_ROLE_MENU:
                // 根据唯一标识查询对应id
                SysRoleMenuEntity sysRoleMenu = new SysRoleMenuEntity();
                sysRoleMenu.setDataIdentification(dataIdentification);
                SysRoleMenuEntity roleMenu = sysRoleMenuService.findList(sysRoleMenu).get(0);

                SysRoleMenuEntity sysRoleMenuEntity = new SysRoleMenuEntity();
                sysRoleMenuEntity.setRoleId(roleMenu.getRoleId());
                List<SysRoleMenuEntity> sysRoleMenuEntityList = sysRoleMenuService.findList(sysRoleMenuEntity);
                for (SysRoleMenuEntity sysRoleMenuEntity1 : sysRoleMenuEntityList) {
                    DataHistoryDTO dataHistoryDTO = new DataHistoryDTO();
                    dataHistoryDTO.setObject(sysRoleMenuEntity1);
                    dataHistoryDTO = setDataHistoryDTO(dataHistoryDTO,sysRoleMenuEntity1.getDataIdentification());
                    list.add(dataHistoryDTO);
                }
                break;
            case ResourceCode.SYS_USER:
                // 根据唯一标识查询对应id
                SysUserEntity sysUser = new SysUserEntity();
                sysUser.setDataIdentification(dataIdentification);
                SysUserEntity suser = sysUserService.findList(sysUser).get(0);

                SysUserEntity sysUserEntity = new SysUserEntity();
                sysUserEntity.setUserId(suser.getUserId());
                List<SysUserEntity> sysUserEntityList = sysUserService.findList(sysUserEntity);
                for (SysUserEntity sysUserEntity1 : sysUserEntityList) {
                    DataHistoryDTO dataHistoryDTO = new DataHistoryDTO();
                    dataHistoryDTO.setObject(sysUserEntity1);
                    dataHistoryDTO = setDataHistoryDTO(dataHistoryDTO,sysUserEntity1.getDataIdentification());
                    list.add(dataHistoryDTO);
                }
                break;
            default:
                break;
        }

        return list;
    }



    private DataHistoryDTO setDataHistoryDTO(DataHistoryDTO dataHistoryDTO,String identification){
        if(!StringUtils.isEmpty(identification)) {
            TNeusoftSysUserEntity tNeusoftSysUserEntity = new TNeusoftSysUserEntity();
            TDataPersistenceBeforceEntity tDataPersistenceBeforceEntity = new TDataPersistenceBeforceEntity();
            TDataPersistenceAfterEntity tDataPersistenceAfterEntity = new TDataPersistenceAfterEntity();
            TNeusoftSysMenuEntity tNeusoftSysMenuEntity = new TNeusoftSysMenuEntity();
            tDataPersistenceBeforceEntity.setDataIdentification(identification);
            tDataPersistenceAfterEntity.setDataIdentification(identification);

            List<TDataPersistenceBeforceEntity> tDataPersistenceBeforceEntityList = tDataPersistenceBeforceService.findList(tDataPersistenceBeforceEntity);
            if(tDataPersistenceBeforceEntityList.size()>0){
                TDataPersistenceBeforceEntity beforceEntity = tDataPersistenceBeforceEntityList.get(0);
                // 角色名称转化
                String roleCode = beforceEntity.getOperatorRoleCode();
                roleCode = AnalysisService.roleMap.get(roleCode);
                beforceEntity.setOperatorRoleCode(roleCode);

                // 关联操作人员信息
                tNeusoftSysUserEntity.setUserId(Long.parseLong(beforceEntity.getOperatorId()));
                List<TNeusoftSysUserEntity> tNeusoftSysUserServiceList = tNeusoftSysUserService.findList(tNeusoftSysUserEntity);
                if(tNeusoftSysUserServiceList.size()>0){
                    TNeusoftSysUserEntity neusoftSysUserEntity = tNeusoftSysUserServiceList.get(0);
                    dataHistoryDTO.setOperUserInfo(neusoftSysUserEntity);
                }
                // 操作编码转换
                tNeusoftSysMenuEntity.setPerms(beforceEntity.getOperatorCode());
                List<TNeusoftSysMenuEntity> tNeusoftSysMenuEntityList = tNeusoftSysMenuService.findList(tNeusoftSysMenuEntity);
                if(tNeusoftSysMenuEntityList.size()>0){
                    TNeusoftSysMenuEntity neusoftSysMenuEntity = tNeusoftSysMenuEntityList.get(0);
                    beforceEntity.setOperatorCode(neusoftSysMenuEntity.getMenuName());
                }

                dataHistoryDTO.setBeforce(beforceEntity);
            }
            List<TDataPersistenceAfterEntity> tDataPersistenceAfterEntityList = tDataPersistenceAfterService.findList(tDataPersistenceAfterEntity);
            if(tDataPersistenceAfterEntityList.size()>0){
                TDataPersistenceAfterEntity afterEntity = tDataPersistenceAfterEntityList.get(0);
                dataHistoryDTO.setAfter(afterEntity);
            }
        }

        return dataHistoryDTO;
    }
}
